<template>
    <page flex="dir:top">
        <m-header>{{gunCode}}号油枪<span class="text2">({{oilCode}})</span></m-header>
        <p class="h44 px12 f16 white tc" style="background-color: #FF5722">请选择待支付订单</p>
        <roll flex-box="1" class="rel">
            <m-loading :show="loadStatus == null" class="absfit"></m-loading>
            <m-msg v-if="loadStatus !=null && !list.length" class="absfit" icon="icon-meiyoushuju">
                <p>该油枪暂无支付信息,<span class="c2" @click="getList">刷新重试</span></p>
            </m-msg>
            <div class="mt10"></div>
            <div v-for="i in list" class="white-bg p12 py4 f14 tap bdb" @click="onSelectLius(i)">
                <p flex="main:justify">
                    <span>流水号: {{i.Id}}</span>
                    <span class="tr text2 f14">{{i.Cdatetime | dateFormat}}</span>
                </p>
                <div flex="main:justify" class="mt10">
                    <span class="c7">金额:{{+i.Prerj}}元</span>
                </div>
            </div>
        </roll>
    </page>
</template>
<script>
  import urljoin from 'url-join'

  export default {
    data () {
      const {gunCode, clientUrl, oilCode, shopId, shopName} = this.$route.params
      return {
        loadStatus: null,
        gunCode,
        oilCode,
        clientUrl,
        shopId,
        shopName,
        list: [],
        form: {}
      }
    },
    created () {
      this.getList()
    },
    computed: {},
    methods: {
      async getList () {
        let {obj} = await this.$get_states(urljoin(this.clientUrl, '/oilgun/getUpGunInfo'), {
          guncode: this.gunCode, state: 2
        })
        this.list = obj || []
      },
      onSelectLius (item) {
        const {Id: oilGunStateId, Prerj: payMoney, Price: price, Oilguncode: gunCode, Rl: oilNumber, Oilname: oilCode} = item
        const form = {
          payMoney: parseInt(payMoney * 100),
          oilNumber: +Number(oilNumber).toFixed(3),
          oilGunStateId,
          oilCode,
          price: parseInt(price * 100),
          gunCode
        }
        const {shopName, shopId} = this
        // console.log({
        //   shopId,
        //   shopName,
        //   ...form
        // })
        this.$router.push({
          name: 'yjjy_qrdd', params: {
            shopId,
            shopName,
            ...form
          }
        })
      }
    },
    components: {}
  }
</script>
<style type="text/scss" lang="scss" scoped>

</style>
